package com.itheima.day15.TCP.test4;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class ServerDemo {
    public static void main(String[] args) throws IOException {
        ServerSocket ss = new ServerSocket(10005);
        Socket accept = ss.accept();

        InputStream is = accept.getInputStream();
        byte[] bytes = new byte[1024];
        int len;
        while((len = is.read(bytes)) != -1){
            System.out.println(new String(bytes,0,len));
        }

        OutputStream os = accept.getOutputStream();
        os.write("你是谁".getBytes());


        os.close();
        is.close();
        ss.close();
    }
}
